define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    var Controller = {
        index: function () {
            Controller.api.bindevent();
            Controller.api.tabevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            },
            tabevent: function () {
                $(document).on("click", ".nav-group li a[data-toggle='tab']", function () {
                    var type = $(this).attr("href").substring(1);
                    if (type === 'all') {
                        $(".table-config tr").show();
                        $("#myTabContent .tab-pane").addClass("in");
                        $("#myTabContent .tab-pane").addClass("active");
                    } else {
                        $(this).find(".table-config tr").hide();
                        $(this).find(".table-config tr[data-type='" + type + "']").show();
                    }
                });

            },
        },
    };

    return Controller;
});
